{
LANG : PASCAL
PROB : namenum
}

program NAMENUM;
const
  fd = 'dict.txt';
  fi = 'namenum.in';
  fo = 'namenum.out';
  ID : array['A'..'Z'] of byte =
  (2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9,0);
  max = 5000;
type
  tu = string[12];
  mang = array[1..max] of tu;
var
  xau, num : mang;
  snum : tu;
  n : integer;

function convert(x : tu) : tu;
var
  i : integer;
  y : tu;
begin
  y := '';
  for i := 1 to length(x) do y := y + char(ID[x[i]] + 48);
  convert := y;
end;

procedure doc;
var
  f : text;
begin
  assign(f, fd); reset(f);
  n := 0;
  while not eof(f) do
  begin
    inc(n);
    readln(f, xau[n]);
    num[n] := convert(xau[n]);
  end;
  close(f);
end;

var
  i, sum : integer;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  doc;
  readln(snum);
  sum := 0;
  for i := 1 to n do
    if num[i] = snum then
    begin
      inc(sum);
      writeln(xau[i]);
    end;
  if sum = 0 then writeln('NONE');
  close(output);
  close(input);
end.